package com.matrix.draft.sockettest.day1;

import java.io.PrintWriter;
import java.net.Socket;
import java.util.stream.IntStream;

public class Client {
    public static void main(String[] args) throws Exception{
        Socket socket = new Socket("localhost", 8080);
        PrintWriter pw = new PrintWriter(socket.getOutputStream(),true);

        IntStream.iterate(1,i->i+1).limit(10).forEach(i->{
            System.err.println("客户端开始写第"+i+"行数据");
            pw.println("DATA"+i);
        });

        System.err.println("客户端写完毕");
        Thread.sleep(100000);
    }
}
